name: Update Gradle Wrapper

on:
  schedule:
    - cron: "0 0 * * *"

permissions:
  contents: read

jobs:
  update-gradle-wrapper:
    permissions:
      contents: write # for gradle-update/update-gradle-wrapper-action
      pull-requests: write # for gradle-update/update-gradle-wrapper-action
    if: github.repository == 'testcontainers/testcontainers-java'
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Update Gradle Wrapper
        uses: gradle-update/update-gradle-wrapper-action@0407394b9d173dfc9cf5695f9f560fef6d61a5fe # v1.0.13
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          labels: dependencies

      - uses: gradle/actions/wrapper-validation@v3
